class Person:

    def __init__(self, name, age):
        self.name = name
        self.age = age
        print("init方法被调用")

    def eat(self):
        print(self.name + " 吃饭")

    def run(self):
        print(self.name + " 跑步")

    def say_hello(self, target):
        print("hello,", target)

    def __str__(self):
        return "姓名：{} 年龄：{}".format(self.name, self.age)


# 1.创建对象
p = Person("桑尼", 20)
# 2.调用对象的方法
p.eat()
p.run()
p.say_hello("小红")

p2 = Person("小红", 18)

print(p)
print(p2)
